<template>
	<div class="model">
		<h2 class="model__title">
			审核详情
			<span @click="close" class="model__title--close">&times;</span>
		</h2>
		<div class="model__content" v-loading="loading">
			<div v-if="data">
				<div class="item" v-if="data.reject_reason">
					<h2 class="item__title">驳回理由</h2>
					<div class="item__reason">
						{{data.reject_reason}}
					</div>
				</div>
				<div class="item">
					<div class="item__title">用户信息</div>
					<div class="item__detail">
						<div class="item__detail--title">用户名:</div>
						<div class="item__detail--value">{{data.member.real_name}}</div>
					</div>
					<div class="item__detail">
						<div class="item__detail--title">手机号:</div>
						<div class="item__detail--value">{{data.member.mobile}}</div>
					</div>
					<div class="item__detail">
						<div class="item__detail--title">用户名:</div>
						<div class="item__detail--value">{{data.member.regist_time | formatTime}}</div>
					</div>
				</div>
				<div class="item">
					<div class="item__title">其他信息</div>
					<div class="item__detail">
						<div class="item__detail--title">申请日期:</div>
						<div class="item__detail--value">{{data.ask_time | formatTime}}</div>
					</div>
					<div class="item__detail">
						<div class="item__detail--title">申请区域:</div>
						<div class="item__detail--value">{{data.area_name}}</div>
					</div>
					<div class="item__detail">
						<div class="item__detail--title">申请理由:</div>
						<div class="item__detail--value">{{data.ask_reason}}</div>
					</div>
				</div>
				<div class="item">
					<div class="item__title">资质图片</div>
					<div v-if="data.ask_res && data.ask_res.length">
						<img v-for="img in data.ask_res" :src="img.thump+'400'" alt="" class="item__pic--img"/>
					</div>
					<div v-else>无</div>
				</div>
			</div>
		</div>
	</div>
</template>

<script>
	export default {
		created(){
			this.fetchSpreadCompanyDetail();
		},
		props: ["id"],
		data() {
			return {
				loading: true,
				data: null
			}
		},
		methods: {
			close() {
				this.$parent.showModel = false;
			},
			fetchSpreadCompanyDetail() {
				this.loading = true;
				var url = `${this.url}/spread/check_ask_spread_company_info.action`;
				var params = {
					ask_spread_company_id: this.id
				};
				this.$http.get(url,{ params }).then((res)=> {
					this.loading = false;
					this.data = res.data.result;
					var area_name = '';
					if(this.data.area) {
						this.data.area.forEach(function(r) {
							if(r.area_name)
								area_name = r.area_name + area_name;
						})
					}
					this.data.area_name = area_name;
				});
			}
		}
	}
</script>

<style lang="scss" scoped>

</style>